#include "mempool.h"

// 示例用法
int main() 
{
    MemoryPool* pool = createPool(16, 100); // 创建100个16字节的块
    if (!pool) return 1;

    // 分配并释放块，验证复用
    void* p1 = allocate(pool);
    void* p2 = allocate(pool);
    printf("分配p1: %p, p2: %p\n", p1, p2);

    deallocate(pool, p1);
    deallocate(pool, p2);

    void* p3 = allocate(pool);
    void* p4 = allocate(pool);
    printf("复用p3: %p, p4: %p\n", p3, p4);

    destroyPool(pool);
    return 0;
}